//
//  AXFDetailViewController.m
//  BEEQUICK
//
//  Created by HH on 16/11/24.
//  Copyright © 2016年 SevenGroup. All rights reserved.
//

#import "AXFDetailViewController.h"
#import "AXFDetailsModel.h"
#import "AXFWhiteNavView.h"

@interface AXFDetailViewController ()<UIWebViewDelegate,AXFWhiteNavViewDelegate>

@end

@implementation AXFDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    
//    self.navigationController.navigationBar.hidden = NO;
}

- (void)setupUI
{
    AXFWhiteNavView *whiteNavView = [[AXFWhiteNavView alloc] init];
    
    NSLog(@"%@",self.model.name);
    
    [whiteNavView setTitleName:self.model.name andFunctionName:nil];
    
    whiteNavView.delegate = self;
    
    [self.view addSubview:whiteNavView];
    
    UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectZero];
    
    webView.delegate = self;
    
    NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://m.beequick.cn/show/productDetail?id=%@&shopId=6303&disabled=0&dealer_id=6303&bigids=2,0&__d=d14ryS1bFkB0dOBn%2Bvd9GDn55g34BaxSwQk6PAIdxaUcOZK4qZM5HpDIlnwAZPd5UyoGAl5VrxjngS7/VNfVPUj2iqrOmO6R3Ek0q/D53DOItoLlaw%2Bf/53dpER4x14eK17f&__v=ios5.9&location_hash=2e7577lNaa2SGYIfkVIoNiFqGKZJN%2B5FTxs8%2By9kiloWjXw%2BgbQ72jrK4GAqINz9FzBwcg1jo0ouZxrlweIQ&zchtauth=e2ce4bEoDMWWB15V98ApGBX150AVjnGXVN7pv7sV4WbS9fEQ&timestamp=1479964569201922&token=222f92ef2ba0b2f15c6f38c4dcbc47cc&mac=4350b3993513184f64304260f4b2e27b",self.model.product_id]];
    
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    
    [webView loadRequest:request];
    
    [self.view addSubview:webView];
    
    [whiteNavView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.offset(0);
        make.height.mas_equalTo(kNAVBARH + 20);
    }];
    
    [webView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(whiteNavView.mas_bottom);
        make.left.right.bottom.equalTo(self.view);
    }];
}

- (void)backToViewController
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
